import UIKit
import CoreLocation

class ViewController: UIViewController, CLLocationManagerDelegate {
    var lm:CLLocationManager!
    override func viewDidLoad() {
        super.viewDidLoad()
        lm = CLLocationManager()
        lm.delegate = self
    }
    override func viewWillAppear(animated: Bool) {
        
        lm.startUpdatingHeading()
        
    }
    func locationManager(manager: CLLocationManager!, didUpdateHeading
        newHeading: CLHeading!) {
            println(newHeading)   
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}
